package com.szy.system.error.exception;

/**
 * @author : zhenyun.su
 * @since : 2019/9/7
 * @Comment: 自定义全局网络异常,用于http异常处理
 */

@Deprecated
public class HttpException extends BaseException {
    public HttpException() {
        super();
    }
    public HttpException(String message) {
        super(message);
    }
    public HttpException(Integer code, String message) {
        super(code,message, null);
    }
    public HttpException(Integer code, String message, Object data) {
        super(code,message, data);
    }
    public static void throwException(Integer code, String message) throws HttpException {
        throw new HttpException(code, message);
    }
    public static void throwException(Integer code, String message, Object data) throws HttpException {
        throw new HttpException(code, message, data);
    }

    public Object message(){
        if (getData() == null) {
            return String.format("code=%s; message=%s", getCode(), getMessage());
        }else{
            return getData();
        }
    }
}
